package com.winz.cultureapp.activity;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.winz.cultureapp.R;
import com.winz.cultureapp.base.BaseAppCompatActivity;
import com.winz.cultureapp.constants.Constants;
import com.winz.cultureapp.entity.PersonItem4ListBean;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 预约记录详情
 */
public class BookExplainDesActivity extends BaseAppCompatActivity {

    @BindView(R.id.tv_top_title)
    TextView mTv_top_title;
    @BindView(R.id.iv_pic)
    ImageView mIv_pic;
    @BindView(R.id.tv_tip)
    TextView mTv_tip;
    @BindView(R.id.iv_state)
    ImageView mIv_state;
    @BindView(R.id.tv_state1)
    TextView mTv_state1;
    @BindView(R.id.tv_state2)
    TextView mTv_state2;
    @BindView(R.id.tv_state3)
    TextView mTv_state3;
    @BindView(R.id.tv_rule)
    TextView mTv_reason;
    @BindView(R.id.ll_reason)
    LinearLayout mLl_reason;

    private PersonItem4ListBean.DataBean.ListBean data;


    @Override
    protected int contentView() {
        return R.layout.activity_book_explain_des;
    }

    @Override
    protected void initViews() {
        setStatusBar(getResources().getColor(R.color.base_color));
        mTv_top_title.setText(getString(R.string.book_explain_des_title));
    }

    @Override
    protected void loadDatas(Intent intent) {
        if (intent != null) {
            if (intent.getExtras() != null) {
                data = (PersonItem4ListBean.DataBean.ListBean) intent.getExtras().getSerializable(Constants.KEY.RECORD.RECORD_DATA);

                switch (data.approveStatus){
                    case 0:
                        mLl_reason.setVisibility(View.GONE);
                        mIv_pic.setImageResource(R.drawable.icon_zy);
                        mTv_tip.setText("您的资料已经上传，后台正在审核，请耐心等待！");
                        mTv_state1.setTextColor(getResources().getColor(R.color.text_33));
                        mTv_state2.setTextColor(getResources().getColor(R.color.base_color));
                        mTv_state3.setTextColor(getResources().getColor(R.color.text_99));
                        mIv_state.setImageResource(R.drawable.icon_state_1);
                        break;
                    case 1:
                        mLl_reason.setVisibility(View.VISIBLE);
                        mTv_reason.setText(data.reason);
                        mIv_pic.setImageResource(R.drawable.icon_succ);
                        mTv_tip.setText("您的资料已经通过后台审核！");
                        mTv_state1.setTextColor(getResources().getColor(R.color.text_33));
                        mTv_state2.setTextColor(getResources().getColor(R.color.text_33));
                        mTv_state3.setTextColor(getResources().getColor(R.color.base_color));
                        mIv_state.setImageResource(R.drawable.icon_state_2);
                        break;
                    case 2:
                        mLl_reason.setVisibility(View.VISIBLE);
                        mTv_reason.setText(data.reason);
                        mIv_pic.setImageResource(R.drawable.icon_faile);
                        mTv_tip.setText("您的资料已经被拒绝！");
                        mTv_state1.setTextColor(getResources().getColor(R.color.text_33));
                        mTv_state2.setTextColor(getResources().getColor(R.color.text_33));
                        mTv_state3.setTextColor(getResources().getColor(R.color.icon_red));
                        mIv_state.setImageResource(R.drawable.icon_state_3);
                        break;
                }
            }
        }
    }

    @OnClick()
    public void onClick() {
        finish();
    }
}
